import { useState } from 'react'

const RandomList = () => {
  let [arr, setArr] = useState([])
  return (
    <>
      <h3>随机数数组</h3>
      <ul>
        {arr.map((n, index) => (
          <li key={index}>{n}</li>
        ))}
      </ul>
      <button
        onClick={() => {
          setArr([...arr, Math.random()])
        }}
      >
        加随机数
      </button>
    </>
  )
}

export default RandomList
